package com.lnsf.bookstore.web.shop.controller;

import com.lnsf.bookstore.common.controller.ApiBaseAction;
import com.lnsf.bookstore.web.book.service.ApiBookService;
import com.lnsf.bookstore.web.chapter.vo.ApiChapter;
import com.lnsf.bookstore.web.shop.service.ApiShopService;
import com.lnsf.bookstore.web.shop.vo.ApiShop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping(value = "/api/shop")
public class ApiShopController extends ApiBaseAction{
	
	@Autowired
	private ApiBookService apiBookService;
	@Autowired
	private ApiShopService apiShopService;

	@RequestMapping("list")
	public Object list(Integer bookId,String view){
		Map<String, Object> resultMap = new HashMap();
		Map map = new HashMap();
		List<ApiShop> list = apiShopService.queryList(map);
		resultMap.put("shops",list);
		return toResponsSuccess(resultMap);
	}

	@RequestMapping("detail")
	public Object detail(Integer id){
		Map<String, Object> resultMap = new HashMap();
		Map map = new HashMap();
		map.put("id",id);
		ApiShop apiShop=apiShopService.queryObject(map);
		resultMap.put("shop",apiShop);
		return toResponsSuccess(resultMap);
	}





}
